﻿@{
    PageMode currPageMode = PageMode.Visit;
    if (TempData["CurrentPageMode"] != null)
    {
        currPageMode = (PageMode)TempData["CurrentPageMode"];
    }
    bool hasDesignMenu = (ViewBag.PageMode & PageMode.Design) == PageMode.Design || (ViewBag.PageMode & PageMode.Manage) == PageMode.Manage;
    bool hasAdminMenu = currPageMode == PageMode.Manage;
}
@if (PortalContext.Current.User.IsAnonymous() == false)
{
<div class="top">
@if (hasDesignMenu)
{
    <link rel="stylesheet" href="@Theme.Style("designmenu.css")" type="text/css" />
    if (currPageMode == PageMode.Design)
    {
        <link rel="stylesheet" href="@Theme.Style("designlayout.css")" type="text/css" />
        <script src='@Theme.Script("design.js")' type="text/javascript"></script>
        if (ViewBag.Page == null)
        {
            <script type="text/javascript">
                $(function () {
                    Popup("Set Page Properties", "/Design/PageProperties/?id=@this.Request.Path");
                });
            </script>
        }
    }
    <div class="design-menu">
        <ul>
            <li><a href="/Module/Index">Modules</a></li>
            <li><a href="/Page/Index">Pages</a></li>
            @if (ViewBag.Page != null)
            {
                if ((ViewBag.PageMode & PageMode.Design) == PageMode.Design)
                {
                <li><a href="/Page/Design/@ViewBag.Page.Name">Design</a></li>
                }
                if ((ViewBag.PageMode & PageMode.Manage) == PageMode.Manage)
                {
                <li><a href="/Page/Manage/@ViewBag.Page.Name">Manage</a></li>
                }
                <li><a href="/Page/Preview/@ViewBag.Page.Name">Preview</a></li>
            }
        </ul>
    </div>
}
@if (hasAdminMenu)
{
    <link rel="stylesheet" href="@Theme.Style("adminmenu.css")" type="text/css" />
    <script src='@Theme.Script("admin.js")' type="text/javascript"></script>
    <div class="admin-menu">
        @Html.CachePartial("AdminMenu", 3600, "_Menu", MenuHelper.GetMenuItems(1))
    </div>
}

    <style type="text/css">
    .user-info
    {
        float: right;
        font-weight: bold;
        margin-top: 6px;
    }
    </style>
    <div class="user-info">
    <span>@PortalContext.Current.User.Account</span>(<span>@PortalContext.Current.User.Name</span>)&nbsp;|&nbsp;
    <a href="/Account/LogOff">@Locale.GetString("Vit.Web", "LogOff")</a>&nbsp;|&nbsp;
    </div>

</div>
}
